package com.sqx.modules.app.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.app.entity.UserMoneyDetails;
import com.sqx.modules.app.service.UserMoneyDetailsService;
import com.sqx.modules.errand.entity.MoneyDetails;
import com.sqx.modules.sys.entity.SysUserEntity;
import com.sqx.modules.sys.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Details")
@AllArgsConstructor
@Api("钱包明细")
public class UserMoneyDetailsController {
    @Autowired
    private UserMoneyDetailsService userMoneyDetailsService;
    @Autowired
    private SysUserService sysUserService;
    @ApiOperation("钱包明细")
    @GetMapping("/queryUserMoneyDetails")
    public Result queryUserMoneyDetails(Integer page, Integer limit, UserMoneyDetails userMoneyDetails) {

        return userMoneyDetailsService.queryUserMoneyDetails(page, limit, userMoneyDetails);
    }

    @ApiOperation("代理用户钱包明细列表")
    @GetMapping("/queryAgentMoneyDetails")
    public Result queryAgentMoneyDetails(Integer page, Integer limit, UserMoneyDetails userMoneyDetails) {
        SysUserEntity sysUserEntity = sysUserService.getLoginUser();
        userMoneyDetails.setUserId(sysUserEntity.getUserId());
        userMoneyDetails.setClassify(2);

        userMoneyDetails.setUserType(3);

        return userMoneyDetailsService.queryUserMoneyDetails(page, limit, userMoneyDetails);
    }


}
